package com.wanmait.recruit.service.impl;

import com.github.pagehelper.PageInfo;
import com.wanmait.recruit.mapper.CompanyHrMapper;
import com.wanmait.recruit.pojo.Company;
import com.wanmait.recruit.pojo.CompanyHr;
import com.wanmait.recruit.pojo.Person;
import com.wanmait.recruit.service.CompanyHrService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

@Service("companyHrService")
@Transactional(rollbackFor = Exception.class)
public class CompanyHrServiceImpl implements CompanyHrService {


    @Resource
    CompanyHrMapper companyHrMapper;

    @Override
    public void insert(CompanyHr object) {
        companyHrMapper.insert(object);
    }

    @Override
    public void delete(CompanyHr object) {

    }

    @Override
    public void update(CompanyHr object) {

    }

    @Override
    public PageInfo<CompanyHr> search(int pageNum, int pageSize) {
        return null;
    }

    @Override
    public CompanyHr findByPerson(Person person) {
        return companyHrMapper.findByPersonId(person.getId());
    }

    @Override
    public List<Person> findByCompany(Company company) {
        return companyHrMapper.findByCompanyId(company.getId());
    }

    @Override
    public void updateHrByPersonId(Integer id) {
        companyHrMapper.deleteByPersonId(id);
    }

}
